using JT808Protocol.Common;
using System;
using System.Text.Json.Serialization;

namespace JT808Protocol.Models.BodyParserStrategy.Location.LocationAddition
{
    /// <summary>
    /// 视频信息丢失详情
    /// </summary>
    public class LaSignalLoss_0x15 : ILocationAddition
    {
        /// <summary>
        /// 信息丢失的通道表，1-32，若相应位为1，则表当对应通道信号丢失
        /// </summary>
        [JsonPropertyName("信息丢失的通道表")] public uint SignalLossChannels { get; set; }

        public override ILocationAddition ReadEntity(ReadOnlySpan<byte> source, int startIndex)
        {
            DataLength = (byte)(source[startIndex + 1] + 2);
            if (DataLength != 4 + 2)
            {
                //Logger.Warn($"位置附加信息的视频信息丢失信息长度错误，略过解析");
                return null;
            }
            SignalLossChannels = ParseHelper.Uint32(ref source, startIndex);

            return this;
        }
    }
}